package com.sgkusbcamdemo;

import android.app.Activity;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbManager;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.TextUtils;

import com.qitianyong.selfclass.FindDeviceUtils;
import com.qitianyong.selfclass.LogUtils;

public class USBAttachActivity extends Activity {

    private UsbDevice device;

    // 在res/xml/device_filter.xml添加usb设备的vid/pid.

    //需要在安装apk后，重新插入usb设备，用户确认并给予默认usb权限。系统会启动此activity
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        finish();
        if ( TextUtils.equals(getIntent().getAction(), UsbManager.ACTION_USB_DEVICE_ATTACHED)) {
            FindDeviceUtils.findDevice();
            LogUtils.i("System","USBAttachActivity");
        }
    }
}
